package cn.ml.sheJiMoShi.factory.simple;

public class Client {
    public static void main(String[] args) {

    }


    //抽象产品
    public interface Product{
        void show();
    }

    //具体产品：ProductA
    static class ConcreteProductA implements Product{
        public void show(){
            System.out.println("具体产品A显示。。。");
        }
    }

    //具体产品B：ConcreteProductB
    static class ConcreteProductB implements Product{
        public void show(){
            System.out.println("具体产品B。。。");
        }
    }

    final static class Const{
        static final int PRODUCT_A = 0;
        static final int PRODUCT_B = 1;
        static final int PRODUCT_C = 2;
    }

    static class SimpleFactory {
        public static Product makeProduct(int kind){
            switch (kind){
                case Const.PRODUCT_A:
                    return new ConcreteProductA();
                case Const.PRODUCT_B:
                    return new ConcreteProductB();
            }
            return null;
        }
    }


}
